package cn.lixiaodan.hqlbuilder.gen;

import cn.lixiaodan.hqlbuilder.util.AppPrefs;

/**
 * 生成器工厂类
 * 
 * @author lixiaodan
 * 
 */
public class GeneratorFactory {
	private static IGenerator single = null;

	public static IGenerator build() {
		if (single == null) {
			String clsname = AppPrefs.getString("GENERATOR");
			try {
				Class clszz = Class.forName(clsname);
				single = (IGenerator) clszz.newInstance();
			} catch (Exception e) {
				e.printStackTrace();
				System.exit(1);
			}
		}
		return single;
	}
}
